import request from '@/utils/request'

// 新增用车信息
export function infoInsert (data) {
    return request({
      url: '/useVehicle/info/insert',
      method: 'post',
      data: data
    })
}

// 新增用车信息评论关联
export function detailsInsert (data) {
  return request({
    url: '/system/details/insert',
    method: 'post',
    data: data
  })
}

// 审批同意驳回
export function approvalFlow (data) {
  return request({
    url: '/api/dingtalk/approvalFlow',
    method: 'post',
    data: data
  })
}
// 查询列表
export function listInfo(query) {
  return request({
    url: '/useVehicle/info/list',
    method: 'get',
    params: query
  })
}

//  根据手机号查询钉钉用户
export function getDingUserList(query) {
  return request({
    url: '/api/dingtalk/getDingUserList',
    method: 'get',
    params: query
  })
}

//  撤回用车申请
export function approvalCancel(data) {
  return request({
    url: '/api/dingtalk/mode/v1/workflow/processInstances/terminate',
    method: 'post',
    data: data
  })
}

// 创建正式版钉钉发起流程-2.0
export function handleInitiate (data) {
  return request({
    url: '/api/dingtalk/mode/v2/initiate',
    method: 'post',
    data: data
  })
}


// 创建耗材明细并发送钉钉评论
export function materialAddList (data) {
  return request({
    url: '/vehicle/material/addList',
    method: 'post',
    data: data
  })
}

// 用车管理-用车申请详情
export function getVehicleInfo (query) {
  return request({
    url: '/useVehicle/info/getInfo',
    method: 'get',
    params: query
  })
}

// 用车管理-用车申请详情的时间轴数据
export function getVehicleApplyInfoByVehicleId (vehicleId) {
  return request({
    url: `/vehicle/apply/record/${vehicleId}`,
    method: 'get'
  })
}

// 获取耗材明细
export function getMaterialList (vehicleId) {
  return request({
    url: `/vehicle/material/getMaterialList/${vehicleId}`,
    method: 'get'
  })
}